QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = QtMaplibre-GL
TEMPLATE = app


# MSVC compiler UTF-8 support
msvc: {
    QMAKE_CXXFLAGS += /utf-8
    QMAKE_CFLAGS += /utf-8
}

# 配置maplibre-native-qt库路径
MAPILLARY_LIB_PATH = D:/common/maplibre-native-qt_v3.0.0_Qt5.15.2_Windows
# 包含头文件路径
INCLUDEPATH += $${MAPILLARY_LIB_PATH}/include

# 链接库路径
LIBS += -L${MAPILLARY_LIB_PATH}/lib

# 根据构建类型链接不同的库
CONFIG(release, debug|release): {
    # Release配置
    LIBS += -lQMapLibre -lQMapLibreWidgets
} else {
    # Debug配置
    LIBS += -lQMapLibred -lQMapLibreWidgetsd
}

SOURCES += \
    main.cpp \
    mainwindow.cpp \
    maplayer.cpp \
    layerconfigdialog.cpp \
    layerconfigmanager.cpp

HEADERS += \
    mainwindow.h \
    maplayer.h \
    layerconfigdialog.h \
    layerconfigmanager.h

FORMS += \
    mainwindow.ui \
    layerconfigdialog.ui

# 取消注释资源文件
RESOURCES += \
    resources.qrc

# 平台相关配置
win32 {
    # Windows平台特定配置
    DESTDIR = ./bin
    
    # 根据构建类型复制相应的DLL文件
    CONFIG(release, debug|release): {
        # Release配置
        QMAKE_POST_LINK = $quote(cmd /c copy /Y "${MAPILLARY_LIB_PATH}/bin/QMapLibre.dll" "./bin/")
        QMAKE_POST_LINK += $escape_expand(\n) $quote(cmd /c copy /Y "${MAPILLARY_LIB_PATH}/bin/QMapLibreWidgets.dll" "./bin/")
    } else {
        # Debug配置
        QMAKE_POST_LINK = $quote(cmd /c copy /Y "${MAPILLARY_LIB_PATH}/bin/QMapLibred.dll" "./bin/")
        QMAKE_POST_LINK += $escape_expand(\n) $quote(cmd /c copy /Y "${MAPILLARY_LIB_PATH}/bin/QMapLibreWidgetsd.dll" "./bin/")
    }
}